﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CorporationWars
{
    [Serializable]
    public class NodePoint : BaseObject
    {
        public BaseNode Node { get; set; }
        public bool Visible { get; set; }

        public NodePoint(Game1 game) : base(game) { }

        public NodePoint(Game1 game, BaseNode node, bool visible) : base(game)
        {
            Node = node;
            Visible = visible;
        }
    }

    [Serializable]
    public class NodeConnection : BaseObject
    {
        public NodePoint[] EndPoints { get; set; }
        

        public NodeConnection(Game1 game) : base(game)
        {
            EndPoints = new NodePoint[2];
        }

        public NodeConnection(Game1 game,NodePoint endPointA, NodePoint endPointB)
            : this(game)
        {
            EndPoints[0] = endPointA;
            EndPoints[1] = endPointB;
        }

        public void CloseConnection()
        {
            
            for(int n = EndPoints.Length-1;n >= 0;n--)
            {
                EndPoints[n].Node = null;
                EndPoints[n] = null;
            }

            EndPoints = null;
        }
    }
}
